/*
 * This file is part of FinVis.
 *
 * FinVis is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * FinVis is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with FinVis.  If not, see <http://www.gnu.org/licenses/>
 *
 * @author Stephen Rudolph
 */

#ifndef FININVESTMENTCOMMANDS_H
#define FININVESTMENTCOMMANDS_H

#include <QUndoCommand>

#include "FinInvestment.h"
#include "FinPortfolio.h"

/**
 * Add default investment undo action
 */
class AddInvestment : public QUndoCommand {
public:
    AddInvestment(FinPortfolio *portfolio, QUndoCommand *parent = NULL);

    void undo();
    void redo();

private:
    FinPortfolio *m_portfolio;
    unsigned int m_investmentID;
};

/**
 * Change investment undo action
 */
class ChangeInvestment : public QUndoCommand {
public:
    ChangeInvestment(FinPortfolio *portfolio, const unsigned int investmentID,
                     FinInvestment newInvestment, QUndoCommand *parent = NULL);
    void undo();
    void redo();

private:
    FinPortfolio *m_portfolio;
    unsigned int m_investmentID;
    FinInvestment m_oldInvestment, m_newInvestment;
};

/**
 * Remove investment undo action
 */
class RemoveInvestment : public QUndoCommand {
public:
    RemoveInvestment(FinPortfolio *portfolio, const unsigned int investmentID,
                     QUndoCommand *parent = NULL);

    void undo();
    void redo();

private:
    FinPortfolio *m_portfolio;
    unsigned int m_investmentID;
    FinInvestment m_investment;
};

#endif // FININVESTMENTCOMMANDS_H
